package data;

import anaydis.sort.data.DataSetGenerator;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class IntegerDataSetGenerator implements DataSetGenerator<Integer> {


    @NotNull
    public List<Integer> createAscending(int i) {
        List list = new ArrayList<Integer>();
        for (int j = 0; j < i; j++) {
            list.add(j + 1);
        }
        return list;
    }

    @NotNull
    public List<Integer> createDescending(int i) {
        List list = new ArrayList<Integer>();
        for (int j = i; j > 0 ; j--) {
            list.add(j);
        }
        return list;
    }

    @NotNull
    public List<Integer> createRandom(int i) {
        List list = new ArrayList<Integer>();
        for(int j = 0 ; j < i ; j++){
           list.add((int)(Math.random()*i)+1);
        }
        return list;
    }

    @NotNull
    public Comparator getComparator() {


        Comparator<Integer> c = new Comparator<Integer>() {
            public int compare(Integer integer, Integer integer1) {
                if (integer > integer1) {
                    return 1;
                }
                if (integer < integer1) {
                    return -1;
                } else {
                    return 0;
                }
            }
        };

        return c;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
